﻿using System;
using System.Collections.Generic;
using System.Xml.Linq;
using HigLabo.Net.Extensions;
using Newtonsoft.Json.Linq;
using System.Linq;

namespace HigLabo.Net.Twitter
{
    /// <summary>
    /// 
    /// </summary>
    public class SearchResult : ResponseObject
    {
        private SearchMetaData _SearchMetadata = null;
        private StatusCollection _Statuses = null;
        /// <summary>
        /// 
        /// </summary>
        public SearchMetaData SearchMetadata
        {
            get { return _SearchMetadata; }
            set { _SearchMetadata = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public StatusCollection Statuses
        {
            get { return _Statuses; }
            set { _Statuses = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public SearchResult(String jsonText)
        {
            this.SetProperty(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public override void SetProperty(String jsonText)
        {
            var d = this.SetData(jsonText);

            this.SearchMetadata = new SearchMetaData(d.ToString("search_metadata"));
            this.Statuses = new StatusCollection(d.ToString("statuses"));
        }
    }
}
